/**
 * Category.java
 * @author Daniel Liu
 * @version 2006-12-22 ����12:12:38
 */
package org.lex.swing.prefs;

import java.awt.Component;
import java.util.Comparator;

import javax.swing.event.ChangeListener;

import org.lex.utils.Changeable;


public interface Category extends Changeable {
	public static enum Action {
		APPLY("Apply", 'A'), RESTORE("Restore Defaults", 'D');
		public String getText() {
			return text;
		}

		public int getMnemonic() {
			return mnemonic;
		}

		private String text = null;
		private int mnemonic = 0;

		private Action(String text, int mn) {
			this.text = text;
			this.mnemonic = mn;
		}
	};

	/**
	 * @return ���õı���
	 */
	public String getTitle();

	/**
	 * @return ���ý���
	 */
	public Component getCategoryComponent();

	/**
	 * ����������Ϣ
	 */
	public void saveConfiguration();

	/**
	 * ����������Ϣ
	 */
	public void loadConfiguration();

	public boolean isSupported(Category.Action action);

	public void performAction(Category.Action action);

	public void addContentChangeListener(ChangeListener l);

	public void removeContentChangeListener(ChangeListener l);

	public static final Comparator<Category> comparator = new Comparator<Category>() {
		public int compare(Category c1, Category c2) {
			return c1.getTitle().compareTo(c2.getTitle());
		}
	};
}
